
package com.joysuch.wwyt.bp.bean;

import lombok.Data;

import java.util.LinkedHashSet;
import java.util.Set;

@Data
public class BpDepartBean {

    // ID
    private Long id;
    // 部门名称
    private String label;
    // 上级部门
    private Long parentId;
    private String parentName;
    private String icon;
    private String code;
    private Integer type;

    private Set<BpDepartBean> children = new LinkedHashSet<>();

    @Data
    public static class SearchDepartBean {
        private String nameOrCode;
        private Integer type;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        BpDepartBean other = (BpDepartBean) obj;
        if (id == null) {
            if (other.id != null)
                return false;
        } else if (!id.equals(other.id))
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

}
